#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#define MS(ts) (unsigned int)((ts.tv_sec * 1000) + (ts.tv_nsec / 1000000))

int main(int argc, char** argv)
{
    int i, j = 0;
    float temp = 0.0;
    struct timespec tp;
    unsigned int start;
    unsigned int load_time;

    /* 使主频变高 */
    for (i = 0; i < 10; ++i) {
        for (temp = 0.0; temp < 2000000.0;) {
            temp = temp + 0.1;
        }
    }

    (void)clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &tp);
    start = MS(tp);

    for (i = 0; i < 100; ++i) {
        for (temp = 0.0; temp < 2000000.0;) {
            temp = temp + 0.1;
        }
    }
    (void)clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &tp);
    load_time = MS(tp) - start;
    printf("HGH-TEST[%s %d] load_time: %5u\n", __FUNCTION__, __LINE__, load_time);

    return 0;
}
